Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

1.1K
Views
Chart.js core.js:6162 ERROR Error: "línea" no es un controlador registrado

 const gainContext = this.gainRef.nativeElement.getContext('2d') gainContext.canvas.height = '300px' new Chart(gainContext, createChartConfig(gainConfig)) function createChartConfig({type, labels, data, label, color}: ChartConfig): ChartConfiguration<"line">{ console.log('3 Chart.defaults', Chart.defaults) return { type: "line", data: { labels, datasets: [ { label, data, borderColor: color, stepped: false, fill: false } ] } }

Esto no funciona: no reconoce la propiedad de tipo como debería en la documentación oficial.

let myChart = new Chart(gananciaContexto, { tipo: 'línea',

¿Qué hice mal?

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Podemos hacer esto de tres maneras.

  1. Al importar:

     import { Chart, registerables } from 'chart.js';

    y luego registrar todos los componentes

     Chart.register(...registerables);
  2. finalmente, hay una ruta separada para hacer exactamente lo anterior por usted, en una línea:

     import Chart from 'chart.js/auto';
  3. Importando y registrando la parte requerida como comenta @Tatyana Molchanova

     import { Chart, ChartConfiguration, LineController, LineElement, PointElement, LinearScale, Title} from 'chart.js'

    y luego regístrelo en el componente antes de instanciar el nuevo gráfico

     Chart.register(LineController, LineElement, PointElement, LinearScale, Title);
over 4 years ago · Santiago Trujillo Report

0

Angular 12 aquí. La respuesta de Gaurev funcionó para mí. Tuve que usar:

 import { Chart, registerables } from 'chart.js'; export class ChartTest { constructor() { Chart.register(...registerables); } // methods to actually make the chart per documentation }
over 4 years ago · Santiago Trujillo Report

0

actualice el paquete npm, funcionó para mí

 npm i chart.js@2.9.4
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!